
def tab_completion():
    try:
        import readline
    except ImportError:
        print_("! No readline")
    else:
        import rlcompleter
        readline.parse_and_bind("tab: complete")
        print_("+ readline")


def inject_reload():
    import imp
    if hasattr(__builtins__, 'reload'):
        return
    __builtins__.reload = imp.reload
    print_("+ Injected imp.reload into __builtins__")


try:
    import sys
except ImportError:
    pass
else:
    if not hasattr(__builtins__, 'print'):
        print_ = lambda message: sys.stdout.write(message + '\n')
    else:
        print_ = getattr(__builtins__, 'print')

    width = 40
    print_(' PYTHONSTARTUP '.center(width, '='))
    inject_reload()
    tab_completion()
    print_('=' * width)
